Imports CAPA_Entidad
Imports CAPA_Negocio
Imports System.Data

Public Class frmBuscarProveedor

    Dim servicio As New PickingNegocio

    Public dv As New DataView

    Sub letra(ByVal inicial As String)
        dv.RowFilter = "PROV_Descripcion LIKE '" & inicial & "%' OR PROV_Codigo LIKE '" & inicial & "%'"
    End Sub

    Sub cambiarForm(ByVal x As Form, ByVal y As Form)
        y.Visible = True
        x.Visible = False
    End Sub

    Sub mensaje(ByVal men As String)
        MsgBox(men, MsgBoxStyle.Information, "Mensajes al Usuario")
    End Sub

    Private Sub txtProveedor_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtProveedor.TextChanged
        letra(txtProveedor.Text.Trim)
    End Sub

    Private Sub btnCancelar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancelar.Click
        txtProveedor.Text = ""
        cambiarForm(Me, frmRegistrarBarra)
    End Sub

    Private Sub dgvProveedor_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles dgvProveedor.DoubleClick
        If dgvProveedor.VisibleColumnCount <> 0 Then
            Dim fila As Integer = dgvProveedor.CurrentRowIndex
            If fila > -1 Then
                frmRegistrarBarra.txtProveedor.Text = dgvProveedor.Item(fila, 0).ToString
                txtProveedor.Text = ""
                cambiarForm(Me, frmRegistrarBarra)
            End If
        Else
            mensaje("No hay proveedores.")
        End If
    End Sub

End Class